<?xml version="1.0" encoding="ISO-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:a="http://www.andromda.org/cartridges/jsf"
	xmlns:tr="http://myfaces.apache.org/trinidad"
	xmlns:ajsfc="http://www.andromda.org/cartridges/jsf/facelets">

<ui:composition template="/layout/layout.xhtml">
	<ui:param name="partialTriggers"
		value="#{fn:split(':manageUserForm_search:newAction :manageUserForm_search:searchResult:loadAction :manageUserForm_edit:saveAction :manageUserForm_edit:saveAndNewAction :manageUserForm_edit:cancelAction',' ')}" />
	<ui:param name="usesUpload" value="true" />
	<ui:define name="content">
		<tr:panelGroupLayout layout="vertical"
			inlineStyle="display:#{manageUserForm.editState?'none':''}">
			<tr:subform id="manageUserForm_search">
				<tr:panelFormLayout>
					<tr:selectOneChoice id="searchForm_status"
						value="#{manageUserForm.searchForm.status}"
						label="#{messages['user.status']}:" required="false"
						readOnly="false" unselectedLabel="">
						<f:converter converterId="com.systemsjr.jrbase.user.UserStatus" />
						<f:selectItems
							value="#{ajsfc:getEnumSelectItems('user.status.','com.systemsjr.jrbase.user.UserStatus')}" />
					</tr:selectOneChoice>
					<tr:inputText id="searchForm_username"
						value="#{manageUserForm.searchForm.username}"
						label="#{messages['user.username']}:" required="false"
						readOnly="false">
					</tr:inputText>
					<tr:inputText id="searchForm_password"
						value="#{manageUserForm.searchForm.password}"
						label="#{messages['user.password']}:" required="false"
						readOnly="false">
					</tr:inputText>
					<tr:inputText id="searchForm_name"
						value="#{manageUserForm.searchForm.name}"
						label="#{messages['user.name']}:" required="false"
						readOnly="false">
					</tr:inputText>
					<tr:inputText id="searchForm_email"
						value="#{manageUserForm.searchForm.email}"
						label="#{messages['user.email']}:" required="false"
						readOnly="false">
					</tr:inputText>
					<tr:inputText id="searchForm_passwordLength"
						value="#{manageUserForm.searchForm.passwordLength}"
						label="#{messages['user.password.length']}:" required="false"
						readOnly="false">
					</tr:inputText>
					<tr:inputText id="searchForm_userId"
						value="#{manageUserForm.searchForm.userId}"
						label="#{messages['user.user.id']}:" required="false"
						readOnly="false">
					</tr:inputText>
					<tr:selectManyListbox id="searchForm_userLocations"
						value="#{manageUserForm.searchForm.userLocations}"
						label="#{messages['user.user.locations']}:" required="false"
						readOnly="false" size="3">
						<c:if test="${!empty manageUserForm.userLocationsBackingList}">
							<c:forEach var="row"
								items="#{manageUserForm.userLocationsBackingList}">
								<f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
							</c:forEach>
						</c:if>
					</tr:selectManyListbox>
					<tr:selectManyListbox id="searchForm_userRoles"
						value="#{manageUserForm.searchForm.userRoles}"
						label="#{messages['user.user.roles']}:" required="false"
						readOnly="false" size="3">
						<c:if test="${!empty manageUserForm.userRolesBackingList}">
							<c:forEach var="row"
								items="#{manageUserForm.userRolesBackingList}">
								<f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
							</c:forEach>
						</c:if>
					</tr:selectManyListbox>
					<tr:selectManyListbox id="searchForm_userClearanceLevels"
						value="#{manageUserForm.searchForm.userClearanceLevels}"
						label="#{messages['user.user.clearance.levels']}:"
						required="false" readOnly="false" size="3">
						<c:if
							test="${!empty manageUserForm.userClearanceLevelsBackingList}">
							<c:forEach var="row"
								items="#{manageUserForm.userClearanceLevelsBackingList}">
								<f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
							</c:forEach>
						</c:if>
					</tr:selectManyListbox>
					<tr:selectOneChoice id="searchForm_individual"
						value="#{manageUserForm.searchForm.individual}"
						label="#{messages['user.individual']}:" required="false"
						readOnly="false" unselectedLabel="">
						<c:if test="${!empty manageUserForm.individualBackingList}">
							<c:forEach var="row"
								items="#{manageUserForm.individualBackingList}">
								<f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
							</c:forEach>
						</c:if>
					</tr:selectOneChoice>
					<tr:selectManyListbox id="searchForm_loginSessions"
						value="#{manageUserForm.searchForm.loginSessions}"
						label="#{messages['user.login.sessions']}:" required="false"
						readOnly="false" size="3">
						<c:if test="${!empty manageUserForm.loginSessionsBackingList}">
							<c:forEach var="row"
								items="#{manageUserForm.loginSessionsBackingList}">
								<f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
							</c:forEach>
						</c:if>
					</tr:selectManyListbox>
					<tr:selectManyListbox id="searchForm_programs"
						value="#{manageUserForm.searchForm.programs}"
						label="#{messages['user.programs']}:" required="false"
						readOnly="false" size="3">
						<c:if test="${!empty manageUserForm.programsBackingList}">
							<c:forEach var="row"
								items="#{manageUserForm.programsBackingList}">
								<f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
							</c:forEach>
						</c:if>
					</tr:selectManyListbox>
					<tr:selectManyListbox id="searchForm_menus"
						value="#{manageUserForm.searchForm.menus}"
						label="#{messages['user.menus']}:" required="false"
						readOnly="false" size="3">
						<c:if test="${!empty manageUserForm.menusBackingList}">
							<c:forEach var="row" items="#{manageUserForm.menusBackingList}">
								<f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
							</c:forEach>
						</c:if>
					</tr:selectManyListbox>
					<f:facet name="footer">
						<tr:panelButtonBar>
							<tr:commandButton id="searchAction"
								text="#{messages['action.search']}"
								action="#{userController.search}"
								accessKey="#{messages['action.search.access.key']}"
								partialSubmit="true" />
							<tr:commandButton id="newAction" text="#{messages['action.new']}"
								action="#{userController.startNew}"
								accessKey="#{messages['action.new.access.key']}"
								partialSubmit="true" immediate="true" />
						</tr:panelButtonBar>
					</f:facet>
				</tr:panelFormLayout>
				<tr:spacer width="1" height="10" />
				<tr:table id="searchResult" allDetailsEnabled="true" var="row"
					rowBandingInterval="1" value="#{manageUserForm.manageableList}"
					rows="#{preferences.maxTableRows}" width="90%"
					inlineStyle="display:#{manageUserForm.manageableList == null? 'none': ''}"
					partialTriggers="searchResult:deleteAction ::searchAction">
					<f:facet name="footer">
						<h:panelGroup>
							<tr:outputText
								value="#{fn:length(manageUserForm.manageableList)}">
								<f:convertNumber groupingUsed="true" />
							</tr:outputText>
							<tr:spacer width="10" height="1" />
							<tr:outputText value="#{messages['records.found']}" />
						</h:panelGroup>
						<h:panelGroup style="width:100%;font-weight:normal">
							<tr:outputText
								value="#{fn:length(manageUserForm.manageableList)}"
								inlineStyle="display:#{empty manageUserForm.manageableList?'none':''}">
								<f:convertNumber groupingUsed="true" />
							</tr:outputText>
							<tr:spacer width="10" height="1"
								inlineStyle="display:#{empty manageUserForm.manageableList?'none':''}" />
							<tr:outputText value="#{messages['records.found']}"
								inlineStyle="display:#{empty manageUserForm.manageableList?'none':''}" />
							<tr:outputText value="#{messages['empty.result.set']}"
								inlineStyle="display:#{empty manageUserForm.manageableList?'':'none'}" />
						</h:panelGroup>
					</f:facet>
					<tr:column width="46px">
						<f:facet name="header">
							<h:panelGroup>
								<tr:commandLink action="#{userController.odsExport}"
									inlineStyle="display:#{empty manageUserForm.manageableList?'none':''}">
									<tr:image source="/images/spreadsheet.png"
										shortDesc="#{messages['export.spreadsheet']}"
										inlineStyle="border-style:none" />
								</tr:commandLink>
							</h:panelGroup>
						</f:facet>
						<h:panelGroup>
							<tr:commandLink id="loadAction"
								actionListener="#{userController.load}" partialSubmit="true"
								immediate="true">
								<tr:image source="/images/tableLoad.gif"
									shortDesc="#{messages['action.load']}"
									inlineStyle="border-style:none" />
								<f:param name="id" id="id" value="#{row.id}" />
							</tr:commandLink>
							<tr:spacer width="10" height="1" />
							<tr:commandLink id="deleteAction"
								actionListener="#{userController.delete}" partialSubmit="true"
								immediate="true">
								<tr:image source="/images/tableDelete.gif"
									shortDesc="#{messages['action.delete']}"
									inlineStyle="border-style:none" />
								<f:param name="id" id="id" value="#{row.id}" />
							</tr:commandLink>
						</h:panelGroup>
					</tr:column>
					<tr:column sortable="true" sortProperty="status">
						<f:facet name="header">
							<tr:outputText value="#{messages['user.status']}" />
						</f:facet>
						<tr:outputText
							value="#{ajsfc:getEnumMessage('user.status.',row.status)}">
						</tr:outputText>
					</tr:column>
					<tr:column sortable="true" sortProperty="username">
						<f:facet name="header">
							<tr:outputText value="#{messages['user.username']}" />
						</f:facet>
						<tr:outputText value="#{row.username}">
						</tr:outputText>
					</tr:column>
					<tr:column sortable="true" sortProperty="password">
						<f:facet name="header">
							<tr:outputText value="#{messages['user.password']}" />
						</f:facet>
						<tr:outputText value="#{row.password}">
						</tr:outputText>
					</tr:column>
					<tr:column sortable="true" sortProperty="name">
						<f:facet name="header">
							<tr:outputText value="#{messages['user.name']}" />
						</f:facet>
						<tr:outputText value="#{row.name}">
						</tr:outputText>
					</tr:column>
					<tr:column sortable="true" sortProperty="email">
						<f:facet name="header">
							<tr:outputText value="#{messages['user.email']}" />
						</f:facet>
						<tr:outputText value="#{row.email}">
						</tr:outputText>
					</tr:column>
					<tr:column sortable="true" sortProperty="passwordLength">
						<f:facet name="header">
							<tr:outputText value="#{messages['user.password.length']}" />
						</f:facet>
						<tr:outputText value="#{row.passwordLength}">
						</tr:outputText>
					</tr:column>
					<tr:column sortable="true" sortProperty="userId">
						<f:facet name="header">
							<tr:outputText value="#{messages['user.user.id']}" />
						</f:facet>
						<tr:outputText value="#{row.userId}">
						</tr:outputText>
					</tr:column>
					<tr:column sortable="false">
						<f:facet name="header">
							<tr:outputText value="#{messages['individual.view.title']}" />
						</f:facet>
						<tr:outputText value="#{row.individual}"
							converter="com.systemsjr.jrbase.individual.crud.IndividualJsfConverter" />
					</tr:column>
				</tr:table>
			</tr:subform>
		</tr:panelGroupLayout>
	</ui:define>
</ui:composition>
</html>